package org.andao.commons.lucene.index;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import org.andao.commons.lucene.core.mapper.BeanMapper;
import org.apache.solr.client.solrj.SolrServerException;



/**
 * lucene搜索索引创建类
 * 
 * @author Seewo Software - Vick.liu (liuguanglin@cvte.cn)
 * 
 */
public interface LuceneIndexCreator {

	/**
	 * 创建索引
	 * 
	 * @param sourceList
	 *            被创建的元数据
	 * @param key
	 * @param beanMapper
	 * @throws SolrServerException
	 * @throws IOException
	 */
	public void createIndexs(List<?> sourceList, String key, BeanMapper beanMapper) throws SolrServerException, IOException;

	/**
	 * 增加一个索引
	 * 
	 * @param obj
	 * @throws IOException 
	 * @throws SolrServerException 
	 */
	public void addIndex(Object obj) throws SolrServerException, IOException;

	/**
	 * 更新一个索引
	 * 
	 * @param targetKey
	 * @param newObj
	 * @throws SolrServerException 
	 * @throws IOException 
	 */
	public void updateIndex(String targetKey, Object newObj) throws IOException, SolrServerException;

	/**
	 * 更新一个索引集合
	 * 
	 * @param map
	 * @throws SolrServerException 
	 * @throws IOException 
	 */
	public void updateIndexs(Map<String, Object> map) throws IOException, SolrServerException;

	/**
	 * 删除一个索引
	 * 
	 * @param obj
	 */
	public void deleteIndex(Object obj);

	/**
	 * 清空所有索引
	 * 
	 * @throws SolrServerException
	 * @throws IOException
	 */
	public void destroyIndex() throws SolrServerException, IOException;

}
